<template>
  <Nav_bar title="提现" right_text="历史记录" @clickRight="$router.push('/historyCash')" />
  <div class="ivestorCashTwoPageBox">
    <div class="cashBox">
      <span class="cashText">分账总金额（元）</span>
      <div class="moneys">￥{{ cashAmount || 0 }}</div>
    </div>
    <!-- <van-button
      class="cash_button"
      :disabled="disabled_cash"
      type="default"
      block
      @click="confirmCash()"
      >确定提现</van-button
    > -->
  </div>
  <Tabbar />
</template>

<script setup>
import { ref, reactive } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import { getCashApi } from '@/api/ivestorCash/ivestorCash'
import { Msg } from '@/utils/tools'
const $router = useRouter()
const $route = useRoute()
const disabled_cash = ref(false)
const cashAmount = ref($route.query.cashAmount)

/**点击确认提现，成功后跳转页面，失败给与文字提示 */
const confirmCash = async () => {
  if (Number(cashAmount.value) <= 0) return Msg('可提现余额不足')
  try {
    const res = await getCashApi()
    $router.push('/cashApplyPage')
  } catch (error) {
    console.log(error)
  }
}
</script>

<style lang="scss" scoped>
.ivestorCashTwoPageBox {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 10px;
  .cashBox {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 347px;
    height: 101px;
    padding: 14px 9px;
    background: #fff;
    .cashText {
      color: #333;
      font-size: 12px;
    }
    .moneys {
      font-size: 26px;
      color: #c80000;
    }
  }
  .cash_button {
    width: 330px;
    height: 39px;
    color: #fff;
    border-radius: 3px;
    background: linear-gradient(90deg, #67e0bc 0%, #14c691 100%);
    margin-top: 33px;
    font-size: 16px;
    font-weight: 600;
  }
}
</style>
